<template>
  <div>
    <el-breadcrumb separator="/">
  <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
  <el-breadcrumb-item :to="{ path: '/myvip' }">当前页面</el-breadcrumb-item>
</el-breadcrumb>
 <el-container style="height: 500px; border: 1px solid #eee">
  <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
    <el-menu :default-openeds="['1', '3']" router >
      <el-submenu index="1">
        <template slot="title"><i class="el-icon-message"></i>会员中心</template>
        <el-menu-item-group>
          <el-menu-item index="999" @click="CheckVip">我的会员</el-menu-item>
          <el-menu-item index="1-2"  @click="CheckVip2">会员成长</el-menu-item>
           <el-menu-item index="1-3" @click="mywallet">钱包</el-menu-item>
        </el-menu-item-group>
 
      </el-submenu>


    </el-menu>
  </el-aside>
  
  <el-container>
    <el-header style="text-align: right; font-size: 12px">
      <el-dropdown>
        <i class="el-icon-setting" style="margin-right: 15px"></i>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>查看</el-dropdown-item>
          <el-dropdown-item>新增</el-dropdown-item>
          <el-dropdown-item>删除</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
        <span>欢迎,尊敬的VIP会员</span>
    </el-header>
    
    <el-main>
      <el-table :data="tableData">
        <el-table-column prop="username" label="会员姓名" width="140">
        </el-table-column>
            <el-table-column prop="nikeName" label="昵称">
        </el-table-column>
        <el-table-column prop="leave" label="会员等级" width="120">
        </el-table-column>
      <el-table-column prop="tel" label="电话">
        </el-table-column>
         <el-table-column prop="email" label="邮箱">
        </el-table-column>
            <el-table-column prop="address" label="地址">
        </el-table-column>
      </el-table>
    </el-main>
  </el-container>
</el-container>

  </div>
</template>

<script>

  export default {
    name:'myvip',
     components:{

     },
    data() {
      const item = {
        username: sessionStorage.getItem("username"),
        leave: sessionStorage.getItem("status"),
        address: sessionStorage.getItem("avater"),
        tel:sessionStorage.getItem("tel"),
        email:sessionStorage.getItem("email"),
        nikeName:sessionStorage.getItem("nikeName"),
      };
      return {
        tableData: Array(1).fill(item),
      }
    },
      methods:{
        CheckVip(){
          this.leave = sessionStorage.getItem("status");
           this.$router.push({path:'/myvip'});
        },
        CheckVip2(){
          //发送ajax请求到后台，获取vip成长值
          this.$ax.get('/epai/user/levelVip',{params:{
             id:sessionStorage.getItem("uid")
          }}).then((response)=>{//axios返回的response并不是后端响应数据，而是经过了封装，提供更为丰富的数据
              if(response.data.success){
                this.$router.push({path:'/myvip_leave'});
              }else{
                alert("失败");
              }  
            }).catch(error => {
              console.log(error);
            });

      },
      mywallet(){
          this.$router.push({path:'/money'});
      }

      }
  };
</script>

<style>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }
  
  .el-aside {
    color: #333;
  }
</style>
